home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc / Sample Code / Sample Editors⁄Viewers / Text Editor / Source / ValueStream.h < prev   
Encoding:
C/C++ Source or Header  |  1995-12-13  |  1.6 KB  |  72 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        ValueStream.h
  3.  
  4.     Contains:    Stream class definition for Textension I/O
  5.  
  6.     Written by:    Steve Smith
  7.     
  8.     Copyright:    © 1994 - 1995 by Apple Computer, Inc., all rights reserved.
  9. */
  10.  
  11.  
  12. #ifndef _VALUESTREAM_
  13. #define _VALUESTREAM_
  14.  
  15. #ifndef _Streams_
  16. #include "Streams.h"
  17. #endif
  18.  
  19. //========================================================================================
  20. // Forward class declarations
  21. //========================================================================================
  22.  
  23. class ODStorageUnitView;
  24. class ODStorageUnit;
  25.  
  26. //========================================================================================
  27. // CLASS SUValueStream
  28. //========================================================================================
  29.  
  30. class    SUValueStream    :    public CStream
  31. {
  32. public:
  33.     SUValueStream();
  34.     virtual ~SUValueStream();
  35.     
  36.     void InitValueStream(ODStorageUnitView *view);
  37.     virtual void Free();
  38.     
  39.     virtual OSErr WriteBytes(const void* theBytes, long bytesCount);
  40.     virtual OSErr ReadBytes(void* theBytes, long bytesCount);
  41.     
  42.     virtual long GetPosition() const;
  43.     virtual void SetPosition(long newPosition);
  44.  
  45.     virtual long GetSize() const;
  46.     
  47.     virtual OSErr Append(long count);
  48.         // Appends "count" bytes at the end of the stream, position is not changed
  49.         
  50.     virtual void Empty();
  51.     
  52.     virtual OSErr Load(long size, Ptr* data);
  53.         //fPosition is advanced by "size"
  54.         
  55.     virtual void Unload(Ptr data);
  56.         //should be called even if "Load" returns an error
  57.  
  58. // ----- New API
  59. public:
  60.     void Skip(long count);
  61.         // Advance fPosition by "count"
  62.  
  63.     ODStorageUnit *GetStorageUnit();
  64.  
  65. private:
  66.     Boolean ValidateStorageUnitView() const;
  67.     
  68.     ODStorageUnitView *fView;
  69. };
  70.  
  71. #endif
  72.